<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>时间限制访问页面</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            min-height: 100vh;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            display: flex;
            justify-content: center;
            align-items: center;
            padding: 20px;
            position: relative;
            overflow: hidden;
        }

        body::before {
            content: "";
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><circle cx="20" cy="20" r="2" fill="rgba(255,255,255,0.1)" /><circle cx="50" cy="50" r="1.5" fill="rgba(255,255,255,0.1)" /><circle cx="80" cy="80" r="1" fill="rgba(255,255,255,0.1)" /></svg>');
            z-index: -1;
        }

        .container {
            width: 100%;
            max-width: 500px;
            background: rgba(255, 255, 255, 0.95);
            border-radius: 20px;
            box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
            overflow: hidden;
            backdrop-filter: blur(10px);
            transform: translateY(0);
            transition: transform 0.3s ease, box-shadow 0.3s ease;
        }

        .container:hover {
            transform: translateY(-5px);
            box-shadow: 0 30px 60px rgba(0, 0, 0, 0.2);
        }

        .header {
            background: linear-gradient(90deg, #4b6cb7 0%, #182848 100%);
            color: white;
            padding: 30px 20px;
            text-align: center;
        }

        .header h1 {
            font-size: 2rem;
            margin-bottom: 10px;
            font-weight: 600;
        }

        .header p {
            opacity: 0.9;
            font-size: 1.1rem;
        }

        .content {
            padding: 40px 30px;
            text-align: center;
        }

        .icon {
            font-size: 4rem;
            margin-bottom: 20px;
        }

        .access-denied .icon {
            color: #e74c3c;
        }

        .access-granted .icon {
            color: #27ae60;
        }

        h2 {
            font-size: 2rem;
            margin-bottom: 15px;
            font-weight: 600;
        }

        .access-denied h2 {
            color: #e74c3c;
        }

        .access-granted h2 {
            color: #27ae60;
        }

        p {
            font-size: 1.1rem;
            line-height: 1.6;
            margin-bottom: 20px;
            color: #555;
        }

        .time-info {
            background: #f8f9fa;
            border-radius: 12px;
            padding: 20px;
            margin: 25px 0;
            border: 1px solid #e9ecef;
        }

        .time-display {
            font-size: 1.3rem;
            font-weight: 600;
            margin: 10px 0;
        }

        .current-time {
            color: #4b6cb7;
        }

        .allowed-time {
            color: #27ae60;
        }

        .btn {
            background: linear-gradient(90deg, #4b6cb7 0%, #182848 100%);
            color: white;
            border: none;
            padding: 12px 30px;
            font-size: 1rem;
            border-radius: 50px;
            cursor: pointer;
            transition: all 0.3s ease;
            font-weight: 500;
            box-shadow: 0 4px 15px rgba(75, 108, 183, 0.3);
        }

        .btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 20px rgba(75, 108, 183, 0.4);
        }

        .btn:active {
            transform: translateY(0);
        }

        .hidden {
            display: none;
        }

        .footer {
            padding: 20px;
            text-align: center;
            background: #f8f9fa;
            color: #6c757d;
            font-size: 0.9rem;
            border-top: 1px solid #e9ecef;
        }

        @media (max-width: 600px) {
            .container {
                border-radius: 15px;
            }

            .header {
                padding: 20px 15px;
            }

            .header h1 {
                font-size: 1.7rem;
            }

            .content {
                padding: 30px 20px;
            }

            h2 {
                font-size: 1.7rem;
            }
        }

        .pulse {
            animation: pulse 2s infinite;
        }

        @keyframes pulse {
            0% {
                transform: scale(1);
            }
            50% {
                transform: scale(1.05);
            }
            100% {
                transform: scale(1);
            }
        }
    </style>
</head>
<body>
<div class="container">
    <div class="header">
        <h1><i class="fas fa-clock"></i> 时间限制访问</h1>
        <p>为您提供安全可靠的时间访问控制</p>
    </div>

    <div class="content">
        <div id="accessDenied" class="access-denied hidden">
            <div class="icon pulse">
                <i class="fas fa-lock"></i>
            </div>
            <h2>访问被拒绝</h2>
            <p>很抱歉，根据系统设置，您当前无法访问此页面。</p>

            <div class="time-info">
                <p>当前时间:</p>
                <div class="time-display current-time" id="currentTimeDenied"></div>
                <p>允许访问时间:</p>
                <div class="time-display allowed-time">06:00 - 23:00</div>
            </div>

            <p>请在允许的时间段内访问此页面。</p>
        </div>

        <div id="accessGranted" class="access-granted hidden">
            <div class="icon">
                <i class="fas fa-unlock-alt"></i>
            </div>
            <h2>欢迎访问</h2>
            <p>您已在允许的时间范围内，可以正常使用此页面。</p>

            <div class="time-info">
                <p>当前时间:</p>
                <div class="time-display current-time" id="currentTimeGranted"></div>
                <p>允许访问时间:</p>
                <div class="time-display allowed-time">06:00 - 23:00</div>
            </div>

            <button class="btn" onclick="refreshTime()">
                <i class="fas fa-sync-alt"></i> 刷新时间
            </button>

            <div style="margin-top: 30px;">
                <h3>页面内容区域</h3>
                <p>这里可以放置您的正常页面内容</p>
            </div>
        </div>
    </div>

    <div class="footer">
        <p>© 2023 时间访问控制系统 | 仅在 06:00 - 23:00 开放访问</p>
    </div>
</div>

<script>
    function formatTime(date) {
        const hours = String(date.getHours()).padStart(2, '0');
        const minutes = String(date.getMinutes()).padStart(2, '0');
        const seconds = String(date.getSeconds()).padStart(2, '0');
        return `${hours}:${minutes}:${seconds}`;
    }

    function checkAccessTime() {
        const now = new Date();
        const currentHours = now.getHours();
        const currentMinutes = now.getMinutes();

        // 格式化当前时间显示
        const currentTimeString = formatTime(now);
        document.getElementById('currentTimeDenied').textContent = currentTimeString;
        document.getElementById('currentTimeGranted').textContent = currentTimeString;

        // 检查是否在允许访问的时间范围内 (6:00 - 23:00)
        const isAccessAllowed = (currentHours > 6 || (currentHours === 6 && currentMinutes >= 0)) &&
            (currentHours < 23 || (currentHours === 23 && currentMinutes === 0));

        if (isAccessAllowed) {
            document.getElementById('accessGranted').classList.remove('hidden');
            document.getElementById('accessDenied').classList.add('hidden');
        } else {
            document.getElementById('accessDenied').classList.remove('hidden');
            document.getElementById('accessGranted').classList.add('hidden');
        }
    }

    function refreshTime() {
        checkAccessTime();
    }

    // 页面加载时检查访问时间
    checkAccessTime();

    // 每秒更新时间显示，每分钟检查访问权限
    let secondsCounter = 0;
    setInterval(() => {
        secondsCounter++;
        checkAccessTime();

        // 每60秒重新检查访问权限
        if (secondsCounter >= 60) {
            secondsCounter = 0;
        }
    }, 1000);
</script>
</body>
</html>
